
import React from 'react';
import { Modal, Button, Form } from 'antd';
import * as Utils from "../../utils_yyr/action";
const { confirm, info } = Modal;
class BasicConfirm extends React.Component {
  state = {
    inputValue: ''
  };

  inputChange = (e) => {
    this.setState({ inputValue: e.target.value })
  }
  showInfo = () => {
    const p = this;
    let content = '';
    if (p.props.data instanceof Array ? p.props.data.length : p.props.data) {
      if (p.props.data.length === 1) {
        content = p.props.data[0].score
        info({
          title: p.props.title,
          content: content,
          okText: '关闭',
          okType: p.props.okType ? p.props.okType : 'primary',
          onOk() {
            console.log("数据", content)
            p.props.handleConfirmInfo(p.props.data);

          },
        });
      } else {
        Utils.openNotification('warning', '请只选择一条单据查看评分')
      }

    } else {
      Utils.openNotification('warning', '请只选择一条单据查看评分')
    }

  }
  render() {
    //button: 是否显示为button  buttonType:按钮类型(显示为按钮时) buttonName:显示的名字 api:需要调用的接口  data:传递的数据 
    //title ：弹出框的title content：需要填写值时  (INPUT,TEXTAREA) 目前仅限一个输入框  icon 按钮图标
    const { button, buttonType, buttonName, icon } = this.props;
    return (
      button ? <Button type={buttonType ? buttonType : 'primary'} icon={icon ? icon : ''} onClick={this.showInfo}>{buttonName}</Button> :
        <a href onClick={this.showInfo}>{buttonName}</a>

    )
  }
}


export default Form.create({})(BasicConfirm);
